
#ifndef __GAMECLOCK_H__
#define __GAMECLOCK_H__

#include "basetype.h"

#include <windows.h>


class CGameClock
{
public:
	CGameClock()
	{
		m_start_clock_count = 0;
	}

	virtual ~CGameClock()
	{
	}

	DWORD Get_Clock()
	{
		// this function returns the current tick count

		// return time
		return(GetTickCount());

	} // end Get_Clock

	///////////////////////////////////////////////////////////

	DWORD Start_Clock()
	{
		// this function starts the clock, that is, saves the current
		// count, use in conjunction with Wait_Clock()

		return(m_start_clock_count = Get_Clock());

	} // end Start_Clock

	////////////////////////////////////////////////////////////

	DWORD Wait_Clock(DWORD count)
	{
		// this function is used to wait for a specific number of clicks
		// since the call to Start_Clock

		while((Get_Clock() - m_start_clock_count) < count);
		return(Get_Clock());

	} // end Wait_Clock


protected:
	DWORD                m_start_clock_count;     // used for timing
};

#endif